package models;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.OneToMany;

import play.data.validation.Required;
import play.db.jpa.Model;

/**
 * Class for table Collection.
 * 
 * @author Elisa
 */
@Entity
public class Collection extends Model {

	@Required
	public String title;
	
	@OneToMany(mappedBy = "collection")
	public List<Book> books = new ArrayList<Book>();
	
	@OneToMany(mappedBy = "collection")
	public List<Cartoon> cartoons = new ArrayList<Cartoon>();
	
	
	/**
	 * Constructor with mandatory fields.
	 * @param title
	 */
	public Collection(final String title) {
		this.title = title;
	}
	

}
